<?php $this->load->view("common/header") ?>
<script type="text/javascript">
$(function() {
	//	$( "#job_start" ).datepicker({ dateFormat: 'yy-mm-dd' });
	});
</script>
<body>
  <div id="page_wrapper">
<?php $this->load->view("common/speel") ?>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td  align="left" valign="top"><?php $this->load->view("nav/main") ?></td>
      <td  valign="top"  id="mainContent"> 
      <?php if(!empty($jobs)) { ?>
      <div class="search_result_block">
      <table width="100%" border="0" cellpadding="5" cellspacing="0" rules="groups">
      <tr>
      	<td colspan="5" class="tbl_header">
        Job related reults
        </td>
      </tr>
    <tr class="tbl_row_header">
    <td align="left"><?php echo $_SESSION['label1'] ?></td>
    <td align="left">Client</td>
    <td align="left">Job Subject</td>
    <td align="left">Type/Pri</td>
    <td align="left">Allocated User</td>
    </tr>
<?php foreach($jobs as $job) { 

?>
  <tr class="tbl_row" onClick="gotoJob('<?php echo $job['id'] ?>')">
    <td width="190" class="item_lbl" align="left" ><?php echo $job['id'] ?></td>
    <td width="248" class="tdClickable"  align="left" ><?php echo $job['company_name'] ?></td>
    <td width="341" class="tdClickable"  align="left" ><?php echo $job['job_subject'] ?></td>
    <td width="248"  class="tdClickable" align="left" ><?php echo $job['job_type'] ?> / <?php echo $job['job_pri'] ?></td>
    <td width="242"  class="tdClickable"  align="left" ><?php echo $job['firstname']." ".$job['lastname']   ?></td>
    </tr>


  <?php } ?>
</table>
      </div> 
 <?php } ?> 
   <?php if(!empty($clients)) { ?>    
      <div class="search_result_block">
      <table width="100%" border="0" cellpadding="5" cellspacing="0" rules="groups">
            <tr>
      	<td colspan="6" class="tbl_header">
        Client related reults
        </td>
      </tr>
    <tr class="tbl_row_header">
    <td align="left">Client name</td>
    <td align="left">Contacts</td>
    <td align="left">Phone</td>
    <td align="left">Email</td>
    <td align="left">Address</td>
    <td align="center">Delete</td>
  </tr>
<?php foreach($clients as $client) { ?>
  <tr class="tbl_row">
    <td width="90" onClick="gotoClient('<?php echo $client['id'] ?>')" align="left"><?php echo $client['company_name'] ?></td>
    <td width="94" onClick="gotoClient('<?php echo $client['id'] ?>')" align="left"><?php echo $client['company_contact1'] ?><br>
      <?php echo $client['company_contact2'] ?></td>
    <td width="77" onClick="gotoClient('<?php echo $client['id'] ?>')" align="left"><?php echo $client['company_phone1'] ?><br>
      <?php echo $client['company_phone2'] ?></td>
    <td width="72" onClick="gotoClient('<?php echo $client['id'] ?>')" align="left"><?php echo $client['company_email'] ?></td>
    <td width="112" onClick="gotoClient('<?php echo $client['id'] ?>')" align="left">
	<?php 
	$address = array($client['company_address1']
				,$client['company_suburb']
				,$client['state']
				,$client['company_postcode']
				);
	
	echo format_client_address($address) ?>
    
    </td>
    <td width="46" align="center" ><input name="client_act_delete_<?php echo $client['id'] ?>" type="checkbox" id="" class="client_act_delete" value="1" jobID="<?php echo $client['id'] ?>">
</td>
  </tr>


  <?php } ?>
  </table>
      </div>
       <?php } ?> 
	  </td>
    </tr>
</table>

<?php $this->load->view("common/footer") ?>
</div>
</body>
</html>
